/*
 *  Copyright 2012.
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */

package org.opu.queryhandler.n.client.services.beans;

import java.io.Serializable;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

/**
 *
 */
@Root
public class DriverDefenition implements Serializable {

    @Element
    private String description;
    @Element(required=false)
    private String fileLocation;
    @Element
    private String driverClass;
    @Element(required=false)
    private String defaultURL;

    public DriverDefenition(String description, String fileLocation, 
            String driverClass, String defaultURL) {
        this.description = description;
        this.fileLocation = fileLocation;
        this.driverClass = driverClass;
        this.defaultURL = defaultURL;
    }

    public DriverDefenition(String description, String fileLocation, String driverClass) {
        this(description, fileLocation, driverClass, null);
    }

    public DriverDefenition() {
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDriverClass() {
        return driverClass;
    }

    public void setDriverClass(String driverClass) {
        this.driverClass = driverClass;
    }

    public String getFileLocation() {
        return fileLocation;
    }

    public void setFileLocation(String fileLocation) {
        this.fileLocation = fileLocation;
    }

    public String getDefaultURL() {
        return defaultURL;
    }

    public void setDefaultURL(String defaultURL) {
        this.defaultURL = defaultURL;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final DriverDefenition other = (DriverDefenition) obj;
        if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
            return false;
        }
        if ((this.fileLocation == null) ? (other.fileLocation != null) : !this.fileLocation.equals(other.fileLocation)) {
            return false;
        }
        if ((this.driverClass == null) ? (other.driverClass != null) : !this.driverClass.equals(other.driverClass)) {
            return false;
        }
        if ((this.defaultURL == null) ? (other.defaultURL != null) : !this.defaultURL.equals(other.defaultURL)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + (this.description != null ? this.description.hashCode() : 0);
        hash = 67 * hash + (this.fileLocation != null ? this.fileLocation.hashCode() : 0);
        hash = 67 * hash + (this.driverClass != null ? this.driverClass.hashCode() : 0);
        hash = 67 * hash + (this.defaultURL != null ? this.defaultURL.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return String.valueOf(description);
    }
}
